package com.solcoo.util;

import java.io.File;

public class FileUtil {
	
	public static void deleteFile(String filePath, String fileName) {
		File file = new File(filePath);
		
		try {
			if (file.exists()) {
				File[] files = file.listFiles();
				
				if (files != null) { 
					for (File f: files) {
						// 目录
						if (f.isDirectory()) {
							deleteFile(f.getPath(), fileName);
						}
						// 文件
						else if (f.isFile()) {
							if (f.getName().equals(fileName)) {
								f.delete();
							}
						}
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}